package com.ruoyi.group.Utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

/**
 * @Author:黄志超
 * @Todo:生成订单号
 * @DateTime:2022/3/8 17:22
 * @Component:蜗牛
 **/
public class MyUtil {
    public String GenerateOrder() {
        SimpleDateFormat dmDate = new SimpleDateFormat("yyyyMMddHH"); // 获取当前时间
        Random random = new Random(); // 定义随机数
        int ran = random.nextInt(10); // 随机数长度位数
        Date date = new Date();
        String dateran = dmDate.format(date);
        String randomMath = dateran + ran;
        return randomMath;
    }
    //获取当前时间字符串
    public String GetDate(){
        SimpleDateFormat dmDate = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss");
        Date date = new Date();
        String format = dmDate.format(date);
        return format;
    }
}
